class Gamestats:
    """跟踪游戏的统计信息"""

    def __init__(self, ai_game):
        """初始化统计信息"""
        self.settings = ai_game.settings
        self.reset_stats()
        # 游戏启动时处于非活跃状态
        self.game_active = False
        # 任何情况下都不应该重置最高分
        with open('high_score.txt')as duqu:
            self.high_score = int(duqu.read())

    def reset_stats(self):
        """初始化在游戏运行期间可能变动的统计信息"""
        self.ship_left = self.settings.ship_limit
        self.score = 0
        self.level = 1
